<%--                                                                       --%>
<%-- Copyright (c) 2003-2005 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ page import = "java.util.*,
                   com.broadvision.process.tools.action.process.ProcessInstanceForm"
%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<%
  java.util.HashMap map= new java.util.HashMap();
  map.put("instanceOid", request.getParameter("instanceOid"));
   
  pageContext.setAttribute("pagetabParam",map);
  String ctxPath = request.getContextPath();
%>

<script language="JavaScript">
var nEnabled = false;
var sEnabled = false;
var eEnabled = false;
var wEnabled = false;
var keepScrolling = false;
var hoverComp = null;
var scrollTask = null;

function appletResize() {
    if (document.body.clientHeight>500) {
      document.applets[0].height = document.body.clientHeight-200;
    }
}

function clearTask() {
   if (scrollTask != null) clearInterval(scrollTask);
   scrollTask = null;
}

function startTask(task, i) {
   if (scrollTask != null) clearTask();
   scrollTask = setInterval(task, i);
}

function enableScrollLeft() {

    if (hoverComp!="left") document.left_arrow.src="<%= ctxPath %>/bp/images/action/left_arrow.gif";
    wEnabled = true;
    if ((nEnabled) && (hoverComp!="nw"))
        document.nw_arrow.src="<%= ctxPath %>/bp/images/action/nw_arrow.gif";
    if ((sEnabled) && (hoverComp!="sw"))
        document.sw_arrow.src="<%= ctxPath %>/bp/images/action/sw_arrow.gif";
}

function enableScrollRight() {
    if (hoverComp != "right") document.right_arrow.src="<%= ctxPath %>/bp/images/action/right_arrow.gif";
    eEnabled = true;
    if ((nEnabled) && (hoverComp!="ne"))
        document.ne_arrow.src="<%= ctxPath %>/bp/images/action/ne_arrow.gif";
    if ((sEnabled) && (hoverComp!="se"))
        document.se_arrow.src="<%= ctxPath %>/bp/images/action/se_arrow.gif";
}

function enableScrollUp() {
    if (hoverComp != "up") document.up_arrow.src="<%= ctxPath %>/bp/images/action/up_arrow.gif";
    nEnabled = true;
    if ((wEnabled) && (hoverComp!="nw"))
        document.nw_arrow.src="<%= ctxPath %>/bp/images/action/nw_arrow.gif";
    if ((eEnabled) && (hoverComp!="ne"))
        document.ne_arrow.src="<%= ctxPath %>/bp/images/action/ne_arrow.gif";
}

function enableScrollDown() {
    if (hoverComp != "down") document.down_arrow.src="<%= ctxPath %>/bp/images/action/down_arrow.gif";
    sEnabled = true;
    if ((wEnabled) && (hoverComp!="sw"))
        document.sw_arrow.src="<%= ctxPath %>/bp/images/action/sw_arrow.gif";
    if ((eEnabled) && (hoverComp!="se"))
        document.se_arrow.src="<%= ctxPath %>/bp/images/action/se_arrow.gif";
}

function disableScrollLeft() {
    document.left_arrow.src="<%= ctxPath %>/bp/images/action/left_arrow_dis.gif";
    document.nw_arrow.src="<%= ctxPath %>/bp/images/action/nw_arrow_dis.gif";
    document.sw_arrow.src="<%= ctxPath %>/bp/images/action/sw_arrow_dis.gif";
    wEnabled = false;
}

function disableScrollRight() {
    document.right_arrow.src="<%= ctxPath %>/bp/images/action/right_arrow_dis.gif";
    document.ne_arrow.src="<%= ctxPath %>/bp/images/action/ne_arrow_dis.gif";
    document.se_arrow.src="<%= ctxPath %>/bp/images/action/se_arrow_dis.gif";
    eEnabled = false;
}

function disableScrollUp() {
    document.up_arrow.src="<%= ctxPath %>/bp/images/action/up_arrow_dis.gif";
    document.nw_arrow.src="<%= ctxPath %>/bp/images/action/nw_arrow_dis.gif";
    document.ne_arrow.src="<%= ctxPath %>/bp/images/action/ne_arrow_dis.gif";
    nEnabled = false;
}

function disableScrollDown() {
    document.down_arrow.src="<%= ctxPath %>/bp/images/action/down_arrow_dis.gif";
    document.sw_arrow.src="<%= ctxPath %>/bp/images/action/sw_arrow_dis.gif";
    document.se_arrow.src="<%= ctxPath %>/bp/images/action/se_arrow_dis.gif";
    sEnabled = false;
}

function left_arrowMouseOver() {
   if (!wEnabled) return;
   document.left_arrow.src="<%= ctxPath %>/bp/images/action/left_arrow_ovr.gif";
   keepScrolling = true;
   hoverComp = "left";
   startTask("scrollLeft()", 50);
}

  function nw_arrowMouseOver() {
     if (!nEnabled) return;
     if (!wEnabled) return;
     document.nw_arrow.src="<%= ctxPath %>/bp/images/action/nw_arrow_ovr.gif";
     keepScrolling = true;
     hoverComp = "nw";
     startTask("scrollNW()", 50);
  }

  function nw_arrowMouseOut() {
     if ((nEnabled) && (wEnabled))
        document.nw_arrow.src="<%= ctxPath %>/bp/images/action/nw_arrow.gif";
     else
        document.nw_arrow.src="<%= ctxPath %>/bp/images/action/nw_arrow_dis.gif";
     hoverComp = null;
     clearTask();
  }

  function ne_arrowMouseOver() {
     if (!nEnabled) return;
     if (!eEnabled) return;
     document.ne_arrow.src="<%= ctxPath %>/bp/images/action/ne_arrow_ovr.gif";
     keepScrolling = true;
     hoverComp = "ne";
     startTask("scrollNE()", 50);
  }

  function ne_arrowMouseOut() {
     if ((nEnabled) && (eEnabled))
        document.ne_arrow.src="<%= ctxPath %>/bp/images/action/ne_arrow.gif";
     else 
        document.ne_arrow.src="<%= ctxPath %>/bp/images/action/ne_arrow_dis.gif";
     hoverComp = null;
     clearTask();
  }

  function sw_arrowMouseOver() {
     if (!sEnabled) return;
     if (!wEnabled) return;
     document.sw_arrow.src="<%= ctxPath %>/bp/images/action/sw_arrow_ovr.gif";
     keepScrolling = true;
     hoverComp = "sw";
     startTask("scrollSW()", 50);
  }

  function sw_arrowMouseOut() {
     if ((sEnabled) && (wEnabled))
        document.sw_arrow.src="<%= ctxPath %>/bp/images/action/sw_arrow.gif";
     else
        document.sw_arrow.src="<%= ctxPath %>/bp/images/action/sw_arrow_dis.gif";
     hoverComp = null;
     clearTask();
  }

  function se_arrowMouseOver() {
     if (!sEnabled) return;
     if (!eEnabled) return;
     document.se_arrow.src="<%= ctxPath %>/bp/images/action/se_arrow_ovr.gif";
     keepScrolling = true;
     hoverComp = "se";
     startTask("scrollSE()", 50);
  }

  function se_arrowMouseOut() {
     if ((sEnabled) && (eEnabled))
        document.se_arrow.src="<%= ctxPath %>/bp/images/action/se_arrow.gif";
     else
        document.se_arrow.src="<%= ctxPath %>/bp/images/action/se_arrow_dis.gif";
     hoverComp = null;
     clearTask();
  }

function left_arrowMouseOut() {
   hoverComp = null;
   if (wEnabled) enableScrollLeft();
   else disableScrollLeft();
   keepScrolling = false;
   clearTask();
}

function right_arrowMouseOver() {
   if (!eEnabled) return;
   document.right_arrow.src="<%= ctxPath %>/bp/images/action/right_arrow_ovr.gif";
   keepScrolling = true;
   hoverComp = "right";
   startTask("scrollRight()", 50);
}

function right_arrowMouseOut() {
   hoverComp = null;
   if (eEnabled) enableScrollRight();
   else disableScrollRight();
   keepScrolling = false;
   clearTask();
}

function up_arrowMouseOver() {
   if (!nEnabled) return;
   document.up_arrow.src="<%= ctxPath %>/bp/images/action/up_arrow_ovr.gif";
   keepScrolling = true;
   hoverComp = "up";
   startTask("scrollUp()", 50);
}

function up_arrowMouseOut() {
   hoverComp = null;
   if (nEnabled) enableScrollUp();
   else disableScrollUp();
   keepScrolling = false;
   clearTask();
}

function down_arrowMouseOver() {
   hoverComp = "down";
   if (!sEnabled) return;
   document.down_arrow.src="<%= ctxPath %>/bp/images/action/down_arrow_ovr.gif";
   keepScrolling = true;
   startTask("scrollDown()", 50);
}

function down_arrowMouseOut() {
   if (sEnabled) enableScrollDown();
   else disableScrollDown();
   keepScrolling = false;
   hoverComp = null;
   clearTask();
}

function scrollLeft() {
   if (wEnabled) document.diagapplet.scrollLEFT();
   else clearTask();
}

function scrollRight() {
   if (eEnabled) document.diagapplet.scrollRIGHT();
   else clearTask();
}

function scrollUp() {
   if (nEnabled) document.diagapplet.scrollUP();
   else clearTask();
}

function scrollDown() {
   if (sEnabled) document.diagapplet.scrollDOWN();
   else clearTask();
}

  function scrollNW() {
     if ((nEnabled) && (wEnabled)) document.diagapplet.scrollNW();
     else clearTask();
  }

  function scrollNE() {
     if ((nEnabled) && (eEnabled)) document.diagapplet.scrollNE();
     else clearTask();
  }

  function scrollSW() {
     if ((sEnabled) && (wEnabled)) document.diagapplet.scrollSW();
     else clearTask();
  }

  function scrollSE() {
     if ((sEnabled) && (eEnabled)) document.diagapplet.scrollSE();
     else clearTask();
  }
</script>
<body onResize="appletResize()" >
<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
      <div class="pageTitle"><bean:write name="bpProcessInstanceForm" property="processInstance.customId"/></div>
      <%@include file="/mc/common/pagetab.jsp" %>
      <div class="pageSubtitle">
        <span class="left"><bean:message key="bp.process.processInstanceDiagram.head" bundle="bp.messages"/></span>
        <span class="right">&nbsp;</span>
      </div>
      <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message key="bp.process.processInstanceDiagram.summary" bundle="bp.messages"/>">
      <tr><td class="errorMessage"><html:errors bundle="bp.messages"/></td></tr>
        <tr>
          <td><img name="nw_arrow" width="20" height="20"
             src="<%= ctxPath %>/bp/images/action/nw_arrow_dis.gif"
             onMouseOver="nw_arrowMouseOver()"
             onMouseOut="nw_arrowMouseOut()"/>
          </td>
          <td align="CENTER">
            <img name="up_arrow" src="<%= ctxPath %>/bp/images/action/up_arrow_dis.gif" width="100" height="20"
              onMouseOver="up_arrowMouseOver()" onMouseOut="up_arrowMouseOut()"/>
          </td>
          <td><img name="ne_arrow" width="20" height="20"
             src="<%= ctxPath %>/bp/images/action/ne_arrow_dis.gif"
             onMouseOver="ne_arrowMouseOver()"
             onMouseOut="ne_arrowMouseOut()"/>
          </td>
        </tr>
        <tr>
          <td>
            <img name="left_arrow" src="<%= ctxPath %>/bp/images/action/left_arrow_dis.gif"
              onMouseOver="left_arrowMouseOver()" onMouseOut="left_arrowMouseOut()"/>
          </td>
          <td width="100%" height="100%">

            <bean:define id="myInstance">
              <bean:write name="bpProcessInstanceForm" property="processInstance"/>
            </bean:define>
            <applet name="diagapplet" width="100%" height="300" MAYSCRIPT
              code="com.broadvision.ssp.diagram.DiagApplet.class"
              codebase="<%= ctxPath %>/bp/applet" archive="bv_diagapplet.jar">
              <param name="descurl" value="<%=ctxPath%>/bp/processInstanceDiagramServlet.do" />
              <param name="enableScrollLeft" value="enableScrollLeft()" />
              <param name="enableScrollRight" value="enableScrollRight()" />
              <param name="enableScrollUp" value="enableScrollUp()" />
              <param name="enableScrollDown" value="enableScrollDown()" />
              <param name="disableScrollLeft" value="disableScrollLeft()" />
              <param name="disableScrollRight" value="disableScrollRight()" />
              <param name="disableScrollUp" value="disableScrollUp()" />
              <param name="disableScrollDown" value="disableScrollDown()" />
            </applet>
          </td>
          <td>
            <img name="right_arrow" src="<%= ctxPath %>/bp/images/action/right_arrow_dis.gif"
              onMouseOver="right_arrowMouseOver()" onMouseOut="right_arrowMouseOut()"/>
          </td>
        </tr>
        <tr>
          <td><img name="sw_arrow" width="20" height="20"
            src="<%= ctxPath %>/bp/images/action/sw_arrow_dis.gif"
            onMouseOver="sw_arrowMouseOver()"
            onMouseOut="sw_arrowMouseOut()"/>
          </td>
          <td align="center">
            <img name="down_arrow" src="<%= ctxPath %>/bp/images/action/down_arrow_dis.gif" width="100" height="20"
              onMouseOver="down_arrowMouseOver()" onMouseOut="down_arrowMouseOut()"/>
          </td>
          <td><img name="se_arrow" width="20" height="20"
             src="<%= ctxPath %>/bp/images/action/se_arrow_dis.gif"
             onMouseOver="se_arrowMouseOver()"
             onMouseOut="se_arrowMouseOut()"/>
          </td>

        </tr>
      </table>
    </td>
  </tr>
</table>
<script language="Javascript1.2">
    appletResize();
</script>
</body>
